package view;

import java.util.ArrayList;

import model.CardStack;

/** Struct storing the selected cards on the table. Essentially just a list of StackFragments. 
 * 
 */
@SuppressWarnings("serial")
public class TableSelection extends ArrayList<StackFragment>{
	
	public TableSelection() {
		super();
	}
	public TableSelection(StackFragment sf) {
		super();
		this.add(sf);
	}
	public boolean containsFragment(CardStack stack) {
		for(StackFragment sf : this) {
			if(sf.stack==stack) 
				return true;
		}
		return false;
	}
	public StackFragment getFragment(CardStack stack) {
		for(StackFragment sf : this) {
			if(sf.stack==stack) 
				return sf;
		}
		return null;
	}
	public int totalSize() {
		int ret = 0;
		for(StackFragment sf : this) {
			ret+=sf.top;
		}
		return ret;
	}
}
